﻿namespace JxcLite.Pages.BaseData;

/// <summary>
/// 商品信息列表页面。
/// </summary>
[Route("/bds/goods")]
[Menu(Constants.BaseData, "商品信息", "ordered-list", 4)]
public class GoodsList : BaseTablePage<GoodsInfo>
{
    private IBaseDataService Service;

    protected override async Task OnInitPageAsync()
    {
        await base.OnInitPageAsync();
        Service = await CreateServiceAsync<IBaseDataService>();
        Table.Form = new FormInfo { Width = 800 };
        Table.OnQuery = Service.QueryGoodsesAsync;
    }

    [Action] public void New() => Table.NewForm(Service.SaveGoodsAsync, new GoodsInfo());
    [Action] public void DeleteM() => Table.DeleteM(Service.DeleteGoodsesAsync);
    [Action] public void Edit(GoodsInfo row) => Table.EditForm(Service.SaveGoodsAsync, row);
    [Action] public void Delete(GoodsInfo row) => Table.Delete(Service.DeleteGoodsesAsync, row);
    [Action] public Task Import() => Table.ShowImportAsync();
    [Action] public Task Export() => Table.ExportDataAsync();
}